home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / WebObjects / WebObjectsDoc_HTML / Reuse / ReusableComponentsEx / ObjectArrayEditorEx.wo / ObjectArrayEditorEx.wos < prev   
Encoding:
Text File  |  1996-03-03  |  2.4 KB  |  99 lines

  1. ////////////////////////
  2. //  ObjectArrayEditor
  3. //  by Charles Lloyd
  4. ////////////////////////
  5.  
  6.  
  7. //////////////////////////
  8. // User Settable Items
  9. //////////////////////////
  10. persistent id localKeyArray;
  11. persistent id localLabelArray;
  12. persistent id localObjectArray;
  13. persistent id localColumnWidthArray;
  14.  
  15. //////////////////////
  16. //    Internal State
  17. //////////////////////
  18. persistent id isEditable;
  19. persistent id editableString;
  20.  
  21. persistent id cellPadding;
  22.  
  23. - awake
  24. {
  25.     id aLocalObject;
  26.  
  27.     if (!localObjectArray) {
  28.         localObjectArray = [NSMutableArray array];
  29.         localKeyArray = @(
  30.                           "Title",
  31.                           "First Name",
  32.                           "Last Name",
  33.                           "Street",
  34.                           "City",
  35.                           "State",
  36.                           "Zip"
  37.                           );
  38.         aLocalObject = @{
  39.             "Title" = "Mr";
  40.             "First Name" = "Joseph";
  41.             "Last Name" = "Bleaux";
  42.             "Street" = "123 Maple";
  43.             "City" = "Reno";
  44.             "State" = "NV";
  45.             "Zip" = "89444";
  46.         };
  47.         aLocalObject = [[aLocalObject mutableCopy] autorelease];
  48.         [localObjectArray addObject:aLocalObject];
  49.  
  50.         aLocalObject = @{
  51.             "Title" = "Ms";
  52.             "First Name" = "Jenny";
  53.             "Last Name" = "McCarthy";
  54.             "Street" = "12337 Sepulvada Blvd";
  55.             "City" = "Los Angeles";
  56.             "State" = "CA";
  57.             "Zip" = "90210";
  58.         };
  59.         aLocalObject = [[aLocalObject mutableCopy] autorelease];
  60.         [localObjectArray addObject:aLocalObject];
  61.  
  62.         aLocalObject = @{
  63.             "Title" = "Dr";
  64.             "First Name" = "Albert";
  65.             "Last Name" = "Einstein";
  66.             "Street" = "3.1428 E. MC Square";
  67.             "City" = "Princeton";
  68.             "State" = "NJ";
  69.             "Zip" = "10134";
  70.         };
  71.         aLocalObject = [[aLocalObject mutableCopy] autorelease];
  72.         [localObjectArray addObject:aLocalObject];
  73.  
  74.         localLabelArray = localKeyArray;
  75.         localColumnWidthArray = @(4, 10, 10, 20, 20, 4, 7);
  76.         isEditable = NO;
  77.         [self toggleEditable];
  78.     }
  79. }
  80.  
  81. - processForm
  82. {
  83.     return self;
  84. }
  85.  
  86.  
  87. - toggleEditable
  88. {
  89.     if (isEditable == YES) {
  90.         isEditable = NO;
  91.         editableString = @"Make Editable";
  92.         cellPadding = 4;
  93.     } else {
  94.         isEditable = YES;
  95.         editableString = @"Make Read Only";
  96.         cellPadding = 0;
  97.     }
  98. }
  99.